package org.unideb.beerfactory.service.test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;

import java.util.Calendar;
import java.util.List;

import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.unideb.beerfactory.dto.RecipeDTO;
import org.unideb.beerfactory.service.ManageRecipeFacadeService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/test-application-context.xml")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ManageRecipeFacadeServiceTest {
	@Autowired
	private ManageRecipeFacadeService manageRecipeFacadeService;

	@Test
	public void Test2getRecipeListTest() {
		List<RecipeDTO> recipeDTOs = manageRecipeFacadeService
				.getRecipeList(0, 10);
		assertFalse(recipeDTOs.isEmpty());
	}

	@Test
	public void Test1createRecipeTest() {
		RecipeDTO recipe = new RecipeDTO();
		recipe.setRecipeName("test");
		recipe.setCost(0.0);
		recipe.setRecDate(Calendar.getInstance().getTime());
		recipe.setRecUserId("Maven test");

		manageRecipeFacadeService.createRecipe(recipe);

		assertNull(recipe);

	}

}
